//
//  RootTabBarController.m
//  OverseasOnlineShopping
//
//  Created by 唐先才 on 16/3/7.
//  Copyright © 2016年 唐先才. All rights reserved.
//

#import "RootTabBarController.h"
#import "TxcPrefixHeader.pch"
#import "VOSNavController.h"
#import <OverseasOnlineShopping-swift.h>


@implementation RootTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self createControllers];
}

- (void)createControllers{
    NSArray *namesArray = @[@"HomePageViewController", @"SearchViewController", @"ShoppingCartViewController", @"MyViewController"];
    NSArray *imageArray = @[@"home_gray", @"search_gray", @"cart_gray", @"my_gray"];
    NSArray *sImageArray = @[@"home_red", @"search_red", @"cart_red", @"my_red"];
    NSArray *titleArray = @[@"首页", @"搜索", @"购物车", @"我"];
    
    for (int i = 0; i < 4; i ++) {
        Class cls = NSClassFromString(namesArray[i]);
        UIViewController *vc = [[cls alloc] init];
        VOSNavController *nav = [[VOSNavController alloc] initWithRootViewController:vc];
        [self addChildViewController:nav];
        nav.navigationBar.barTintColor = [UIColor colorWithRed:219 / 255.0 green:35 / 255.0 blue:47 / 255.0 alpha:1.0];
        nav.tabBarItem.title = titleArray[i];
        nav.tabBarItem.image = [UIImage imageNamed:imageArray[i]];
        UIImage *sImage = [UIImage imageNamed:sImageArray[i]];
        nav.tabBarController.tabBar.tintColor = [UIColor redColor];
        nav.tabBarItem.selectedImage = [sImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    }
}

- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

@end
